package name.cyh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import name.cyh.model.po.Inventory;
import org.apache.ibatis.annotations.Param;

/**
 * @author 18433
 */
public interface InventoryMapper extends BaseMapper<Inventory> {
    /**
     * 乐观锁库存
     * @param productId 商品ID
     * @param availableQuantity 商品可用数量
     * @param quantity  购买商品数量
     * @return 是否成功
     */
    int lockInventoryWithOptimisticLock(@Param("quantity") int quantity, @Param("productId")int productId, @Param("availableQuantity")int availableQuantity) ;
}
